import React, {Component} from "react";
import {connect} from "react-redux";
import {AdminConsoleContainer, MainContainer} from './style';
import {renderRoutes} from "react-router-config";
import {actions} from "@/store/home/Article";

class AdminConsole extends Component {
    constructor(props) {
        super(props);
        /*默认直接访问用户管理界面*/
        // this.props.history.push('/mine/admin/data-control/u-list');
    }

    render() {
        return (
            <AdminConsoleContainer>
                <MainContainer>
                    {
                        renderRoutes(this.props.route.routes)
                    }
                </MainContainer>
            </AdminConsoleContainer>
        )
    }
}

// 托管全部子组件的State
export const AdminConsole_mapStateToProps = (state) => {
    return Object.assign(state.toJS().admin, state.toJS().window, state.toJS().HomeArticle);

}
export const AdminConsole_mapDispatchToProps = (dispatch) => {
    return {
        getHomeArticle() {
            dispatch(actions.SagaQuery());
        }
    }
}
export default connect(AdminConsole_mapStateToProps, AdminConsole_mapDispatchToProps)(AdminConsole);
